The present technique relates to an apparatus and method for inhibiting roundoff error in a floating point argument reduction operation.
There are a number of floating point computations used in modern data processing systems that require specified degrees of accuracy in the results obtained when performing those computations. One example is a floating point logarithm computation. For example in the field of graphics processing units (GPUs), there are several application programming interfaces that typical GPU designs must support, where logarithm functions are required. These functions are typically base-2 and base-e (natural) logarithms, that may for example take a single precision (FP32) floating point input value, and produce a single precision floating point result. It is often the case that these logarithm functions are required to exhibit small relative error for the whole representable input range.
One known approach for implementing a logarithm function employs as one of its steps an argument reduction step. To ensure logarithm results are produced with the required accuracy, it is desirable for such a reduction step to be performed without introducing roundoff error. However, known techniques for performing an argument reduction step without introducing roundoff error rely heavily on multi-precision arithmetic, which significantly increases the cost and complexity of the circuitry.
An alternative approach for performing a logarithm operation may employ a power-of-two scaling that reduces the input value to a range from 0.5 to 1, and then use a piecewise-cubic function to approximate the logarithm, with the piecewise-cubic function provided from a lookup table. However, such an approach can result in the need for a very large and irregular lookup table to provide sufficiently-accurate piecewise-cubic functions for input values close to 1.
It would hence be desirable to provide a technique that can be used when performing computations such as logarithm computations, that alleviates the above described issues.